/*
 * Copyright (c) 2023 iQi.Co.Ltd. All rights reserved.
 */
 
using IQIGame.Onigao.Framework;
using System.Collections.Generic;
using System.Linq;
using System;
using NetProtocol.Enum;

namespace NetProtocol.POD {

	/// <summary>
	///  Game服添加关卡玩家
	/// module : structs_internal
	/// </summary>
	public class GameEnterLevelPOD : IPOD 
    {
        public readonly static Func<GameEnterLevelPOD> FACTORY = () => new GameEnterLevelPOD();
		public static Func<GameEnterLevelPOD> DynamicFactory = FACTORY;
        
		/*-- members --*/
		/// <summary>
        /// 
        /// </summary>
		public int levelCid;
		/// <summary>
        /// 
        /// </summary>
		public long levelId;
		/// <summary>
        ///  区域cid，可能需要直接到某个区域
        /// </summary>
		public int regionCid;
		/// <summary>
        ///  传送门id
        /// </summary>
		public int portalId;
		/// <summary>
        ///  客户端主城时间
        /// </summary>
		public long clientTime;
		/// <summary>
        ///  目标位置
        /// </summary>
		public Vector3POD pos;
		
		
		
		/*-- constructors --*/
		public GameEnterLevelPOD() {}
		public GameEnterLevelPOD(int levelCid, long levelId, int regionCid, int portalId, long clientTime, Vector3POD pos) {
			this.levelCid = levelCid;
			this.levelId = levelId;
			this.regionCid = regionCid;
			this.portalId = portalId;
			this.clientTime = clientTime;
			this.pos = pos;
		}
	      public void Serial(SOutputStream _out) {
            _out.Write_int(levelCid);
            _out.Write_long(levelId);
            _out.Write_int(regionCid);
            _out.Write_int(portalId);
            _out.Write_long(clientTime);
            _out.Write_pod(pos);
        }
        
        public void UnSerial(SInputStream _in) {
            if(!_in.HasRemaining()) return;
            levelCid = _in.Read_int();
            if(!_in.HasRemaining()) return;
            levelId = _in.Read_long();
            if(!_in.HasRemaining()) return;
            regionCid = _in.Read_int();
            if(!_in.HasRemaining()) return;
            portalId = _in.Read_int();
            if(!_in.HasRemaining()) return;
            clientTime = _in.Read_long();
            if(!_in.HasRemaining()) return;
            pos = _in.Read_pod<Vector3POD>(Vector3POD.DynamicFactory);
        }
		
		public GameEnterLevelPOD Clone() {
            GameEnterLevelPOD o = DynamicFactory();
            o.levelCid = levelCid;
            o.levelId = levelId;
            o.regionCid = regionCid;
            o.portalId = portalId;
            o.clientTime = clientTime;
            if (pos != null) {
                o.pos = pos.Clone();
            }
            return o;
        }
        
        public void Clear() {
            levelCid = default;
            levelId = default;
            regionCid = default;
            portalId = default;
            clientTime = default;
            pos = default;
        }
		
        public override string ToString() {
			string str = "";
			str += "GameEnterLevelPOD [";
			str += "levelCid=";
			str += levelCid;
			str += ", levelId=";
			str += levelId;
			str += ", regionCid=";
			str += regionCid;
			str += ", portalId=";
			str += portalId;
			str += ", clientTime=";
			str += clientTime;
			str += ", pos=";
			str += pos;
			str += "]";
			return str;
		}
		
	}
}